package com.yulongtian.weekCompetition.month202303.week01;

import java.util.Arrays;

/**
 * 第 99 场双周赛
 * 可
 *
 * @author yulongTian
 * @create 2023-03-04 22:26
 */
public class Test01 {
    public static void main(String[] args) {

    }

    public int splitNum(int num) {
        String s = String.valueOf(num);
        int[] nums = new int[s.length()];
        for (int i = 0; i < nums.length; i++) {
            nums[i] = s.charAt(i) - '0';
        }
        Arrays.sort(nums);
        String s1 = "";
        String s2 = "";
        for (int i = 0; i < nums.length; i++) {
            if (i % 2 == 0) {
                s1 += String.valueOf(nums[i]);
            } else {
                s2 += String.valueOf(nums[i]);
            }
        }

        return Integer.valueOf(s1) + Integer.valueOf(s2);
    }

}
